package com.xy.controller.calculate.lirun.temu;

import com.xy.api.model.dto.calculate.lirun.temu.TemuLirunProductDTO;
import com.xy.api.model.request.calculate.lirun.temu.TemuLirunProductRequest;
import com.xy.api.model.response.R;
import com.xy.api.model.response.Rows;
import com.xy.api.service.calculate.lirun.temu.ITemuLirunProductService;
import com.xy.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/calculate/lirun/temu/product")
public class TemuLirunProductController extends BaseController {

    @Autowired
    private ITemuLirunProductService temuLirunProductService;

    @PostMapping("/list")
    public R queryProductList(@RequestBody TemuLirunProductRequest request) {
        Rows<TemuLirunProductDTO> rows = temuLirunProductService.queryProductList(request);
        return success(rows);
    }

    @PostMapping("/edit")
    public R editProduct(@RequestBody TemuLirunProductDTO request) {
        temuLirunProductService.editProduct(request);
        return success();
    }

    @PostMapping("/delete")
    public R deleteProduct(@RequestBody TemuLirunProductDTO request) {
        temuLirunProductService.deleteProduct(request);
        return success();
    }

    @PostMapping("/detail")
    public R productDetail(@RequestBody TemuLirunProductDTO request) {
        TemuLirunProductDTO detail = temuLirunProductService.productDetail(request);
        return success(detail);
    }
}
